// standard library
#include<cstdio>
#include<iostream>
#include<math.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_multiroots.h>

#ifndef __H_STICK
#define __H_STICK
typedef struct {
	double x, y, z;
} Point;

typedef struct {
	double a, b, c, d;
} ParFor1;

typedef struct {
	double a, b, c, d;
} ParFor2;

typedef struct {
	int precision;
	int current; 
} ParForPhi;

typedef struct {
	ParFor1 for1;
	ParFor2 for2;
	ParForPhi forPhi;
	double zPlain;
} Parameters;

double surface1(ParFor1 par, Point P);
double surface2(ParFor2 par, Point P, Point S);
double tangential1(ParFor1 par1, ParFor2 par2, Point P, Point S);
double tangential2(ParFor1 par1, ParFor2 par2, Point P, Point S);
double dPhi(Point S, ParForPhi par);

int function(const gsl_vector *x, void *params, gsl_vector *y);

void print_state (size_t iter, gsl_multiroot_fsolver * s);

void useGSL(int(*fun)(const gsl_vector *x, void *par, gsl_vector *y),\
		void *par, int n, double *x0, int i, double ** result);

double calculateArea(double *x, double *y, int N);
#endif
